package com.laogao.lesson059.web;

import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

import javax.servlet.http.HttpServletRequest;

/**
 * <b>description</b>： Java进阶、性能优化实战案例100讲，微信公众号:程序员恰恰，源码 & 文档 & 技术支持，请加个人微信号：it3306 <br>
 * <b>time</b>：2025/4/26 20:37 <br>
 * <b>author</b>：ready lao_gao
 */
@RestControllerAdvice
@Slf4j
public class GlobalExceptionHandler {

    @ExceptionHandler(UnsupportedOperationException.class)
    public String handleBusinessException(UnsupportedOperationException e, HttpServletRequest request) {
        log.info("请求：{}，发生异常：{}", request.getRequestURL(), e.getMessage(), e);
        return e.getMessage();
    }
}
